$("form").validate({
    rules: {
        name: {
            required: true,
            minlength: 2,
            maxlength: 16
        },
        password: {
            required: true,
        }
    },
    onkeyup: false,
    focusCleanup: true,
    success: "valid",
    submitHandler: function (form) {
        $("input[type='submit']").attr('disabled', true)
        $(form).ajaxSubmit({
            data: {
                "sign": ""
            },
            success: function (data) {
                data = $.parseJSON(data)
                if (data.code == '1') {
                    window.location.href = "/index.html";
                    return;
                }
                layer.msg(data.message, {icon: 0, time: 1000});
                $("input[type='submit']").attr('disabled', false);
            },
            error: function () {
                alert("error")
            },
            // clearForm : true,    // 成功提交后，清除所有表单元素的值
            // resetForm : true,    // 成功提交后，重置所有表单元素的值
            // timeout : 3000    // 限制请求的时间，当请求大于3秒后，跳出请求
        });
    }
});